#ifndef __MONKEY_SLIDE__PARALLAX_MANAGER__
#define __MONKEY_SLIDE__PARALLAX_MANAGER__

#include "CCParallaxNodeExtras.h"
#include "Monkey.h"
#include "Tree.h"
#include "Cloud.h"


class ParallaxList:public CCNode
{
	private:

		int rapduoi;

		CCArray *trees; // Mang de quan ly cay
		CCArray *backGrounds; // Mang de quan ly anh nen
		CCArray *clouds; // Mang de quan ly dam may

		Monkey* mMonkey;

		CCParallaxNodeExtras *_treeNode; // node de quan ly cac cat
		CCParallaxNodeExtras *_cloudNode; // node de quan ly cac dam may
		CCParallaxNodeExtras *_backgroundNode; // Node de quan ly anh nen

		Background *bg1;
		Background *bg2;

		CCSize visibleSize;
		bool isChoose; // Xac dinh cay dang duoc chon
		float sizeX;

		int mCurrentTree;

	public:
		static ParallaxList * create(Monkey * mMonkey);
		CCArray * fGetTrees();
		bool init(Monkey * mMonkey);
		virtual void update(float dt);

		void fCheckMovePass();
		// Set lai tag cho Tree -> muc dich lam moi va tai su dung lai -> neu can -> khong phai xoan :))
		void fRenewTree();

		void fCreateTrees();

		// Bind player -> player o day la con khi
		void fBindPlayer(Monkey * mMonkey);

		// Quan ly di chuyen man hinh sang trai hoac phai
		void fParallaxMoveTo(CCPoint p);

		inline int fGetCurrentTree() {return mCurrentTree;}
		inline float fGetSizeX() {return sizeX;}
		// Viet ham sinh vi tri ngau nhien
};


#endif